import request from "@/utils/request";

/**
 * 获取列表
 * @param {} params
 * @returns
 */
export function getData(params) {
  return request({
    url: "/gift/general-gift",
    method: "get",
    params
  });
}

/**
 * 获取所有礼物分类
 */
export function getCateData() {
  return request({
    url: "/gift/category/sub-categories",
    method: "get"
  });
}

/**
 * 获取所有礼物标签
 */
export function getTagData() {
  return request({
    url: "/gift/tag/all",
    method: "get"
  });
}

/**
 * 添加礼物
 */
export function postData(data) {
  return request({
    url: "/gift/general-gift",
    method: "post",
    data
  });
}

/**
 * 编辑礼物
 */
export function putData(data) {
  return request({
    url: "/gift/general-gift",
    method: "put",
    data
  });
}

/**
 * 获取礼物详情
 * @param {id} 礼物ID
 * return
 */
export function getDataDetail(id) {
  return request({
    url: "/gift/detail",
    method: "get",
    params: { id }
  });
}

/**
 * 删除礼物
 */
export function deleteData(ids) {
  return request({
    url: "/gift",
    method: "delete",
    data: { ids }
  });
}

/**
 * 赠送
 */
export function sendPostData(data) {
  return request({
    url: "/gift/give",
    method: "post",
    data
  });
}

/**
 * 设置定时上下架
 */
export function postStatusCrontab(data) {
  return request({
    url: "/gift/status-crontab",
    method: "post",
    data
  });
}

/**
 * 置顶
 */
export function postSetTop(id) {
  return request({
    url: "/gift/set-top",
    method: "put",
    data: { id }
  });
}

/**
 * 切换上下架
 */
export function postChangeStatus(id) {
  return request({
    url: "/gift/status",
    method: "put",
    data: { id }
  });
}

/**
 * 获取礼物类别
 */
export function typeList() {
  return request({
    url: "/gift_type/list",
    method: "post"
  });
}

/**
 * 礼物列表- 广播管理列表下拉框
 */
export function broadcastsDropDownList() {
  return request({
    url: "/gift/general-gift/broadcasts",
    method: "get"
  });
}

/**
 * 统计标签
 */
export function tagList() {
  return request({
    url: "/gift/general-gift/tag/list",
    method: "get"
  });
}
